package com.sense.kukoo.common.repo.kv.login

import com.sense.kukoo.common.repo.http.bean.LoginResultBean
import com.sense.kukoo.common.repo.kv.KukooKeyValueManager
import com.sense.kukoo.lib_logger.LoggerManager
import com.tencent.mmkv.MMKV

class LoginImpl(val mmkv: MMKV):Login {

    override fun setLogin(b: LoginResultBean?) {
        LoggerManager.d("Login.setLogin=${b}")
        mmkv.encode(KukooKeyValueManager.KEY_LOGIN, b)
    }

    override fun get(): LoginResultBean? = mmkv.decodeParcelable(KukooKeyValueManager.KEY_LOGIN, LoginResultBean::class.java)

    override fun isLogin(): Boolean = mmkv.decodeParcelable(KukooKeyValueManager.KEY_LOGIN, LoginResultBean::class.java) != null
}